package com.chinasofti.tcp2;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class SeverDemo {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10000);
        Socket accert = ss.accept();
        InputStream is=accert.getInputStream();
        int b;
        while ((b=is.read()) !=-1){
            System.out.print((char)b);
        }
        System.out.println();
        System.out.println("看看收到信息没有！！！");
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(accert.getOutputStream()));
        bw.write("你sei？？？");
        bw.newLine();
        bw.flush();
        //后开先关
        bw.close();
        is.close();
        accert.close();
        ss.close();
    }
}
